﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using IQKS.AWP.DataAccessLayer;
using IQKS.AWP.BusinessObject;

namespace IQKS.AWP.BusinessAccessLayer
{
    public class BriefMasterBAL
    {
        public DataSet GetBriefMaster()
        {
            DataSet objDs;
            try
            {
                objDs = new BriefMasterDAL().GetBriefMaster(0);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }

        //public ActivityMasterBO


        public BriefMasterBO GetBriefMaster(params object[] param)
        {

            BriefMasterBO objBMBo;
            try
            {

                objBMBo = new BriefMasterBO();
                DataSet objDs;
                objDs = new BriefMasterDAL().GetBriefMaster(param);
                if (objDs != null)
                {
                    DataTable objDt = objDs.Tables[0];
                    if (objDt != null)
                    {
                        objBMBo.CountryID=Convert.ToInt32(objDt.Rows[0]["CountryID"]);
                        objBMBo.BriefID=Convert.ToInt32(objDt.Rows[0]["BriefID"]);
                        //objBMBo.BriefDocumentID=Convert.ToInt32(objDt.Rows[0]["BriefDocumentID"]);
                         objBMBo.BriefTitle = Convert.ToString(objDt.Rows[0]["BriefTitle"]);
                         objBMBo.BriefDesc = Convert.ToString(objDt.Rows[0]["BriefDesc"]);
                         objBMBo.BriefStatus = Convert.ToString(objDt.Rows[0]["BriefStatus"]);
                         objBMBo.BriefStartDate = Convert.ToDateTime(objDt.Rows[0]["BriefStartDate"]);
                        objBMBo.BriefEndDate = Convert.ToDateTime(objDt.Rows[0]["BriefEndDate"]);
                        objBMBo.DocumentName=Convert.ToString(objDt.Rows[0]["DocumentName"]);
                        objBMBo.GDDocumentName = Convert.ToString(objDt.Rows[0]["GDDocumentName"]);
                        objBMBo.DocumentPath= Convert.ToString(objDt.Rows[0]["DocumentPath"]);
                        objBMBo.IsActive = Convert.ToBoolean(objDt.Rows[0]["IsActive"]);

                    }
                    else
                    {
                        objBMBo = null;
                    }
                }

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objBMBo;
        }


        public object SetBriefMaster(BriefMasterBO param)
        {
            try
            {
                return new BriefMasterDAL().SetBriefMaster(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public object CopyBriefMasterBetweenCountry(params object[] param)
        {
            try
            {
                return new BriefMasterDAL().CopyBriefMasterBetweenCountry(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }


        public string SetBriefMasterClearBrief(int intBriefID,Guid UserID)
        {
            try
            {
                return new BriefMasterDAL().SetBriefMasterClearBrief(intBriefID,UserID);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
    }
}
